<?php

namespace App\Http\Controllers\View\User;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Facades\Services\User\DoctorService;
use App\Facades\Utils\ValidateParameter;

class DoctorController extends Controller
{
    public function index()
    {	
        return view('pages.user.doctor.list',[
        		'waiKes' => DoctorService::getDoctorsByWaiKe(),
        		'neiKes' => DoctorService::getDoctorsByNeiKe(),
        		'oneSelf' => DoctorService::getDoctorByOneSelf()
        	]);
    }

    public function message(Request $request){

        $rules = [
            'id' => 'required|exists:wechat_doctor_infos,id'
        ];

        ValidateParameter::validate($request,$rules);

        $data = $request->all();

        // DoctorService::judge($data);

    	return view('pages.user.doctor.message',[
                'doctor' => DoctorService::getDoctorAndMessage($data),
                'user' => session('wechat.oauth_user'),
                'isMessage' => DoctorService::judge($data)
            ]);
    }
}
